package com.redrose.rxandroiddemo.main.activity;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import com.redrose.rxandroiddemo.R;
import com.redrose.rxandroiddemo.base.BaseActivity;
import com.redrose.rxandroiddemo.base.BaseAdapter;
import com.redrose.rxandroiddemo.databinding.ActivityTransparentBinding;
import com.redrose.rxandroiddemo.databinding.ItemPictureBinding;

public class TransparentActivity extends BaseActivity<ActivityTransparentBinding> {

    private RecyclerView mRecyclerView;

    @Override
    protected void initEvent() {
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_transparent;
    }

    @Override
    protected void initView() {
        mRecyclerView = mBinding.recyclerView;
    }

    @Override
    protected void initData() {
        MyAdapter mAdapter = new MyAdapter();
        mRecyclerView.setAdapter(mAdapter);
    }

    public static class MyAdapter extends BaseAdapter<ItemPictureBinding> {

        @Override
        protected int getLayoutRes() {
            return R.layout.item_picture;
        }

        @Override
        public int getItemCount() {
            return 8;
        }

        @Override
        protected void bindView(ItemPictureBinding binding, int position) {
            ImageView image = binding.image;
            image.setImageResource(R.mipmap.pic1);
            image.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(v.getContext(),"111",Toast.LENGTH_SHORT).show();
                }
            });
        }
    }
}